<%@page pageEncoding = "utf-8" contentType = "text/html;charset=utf-8"%>

<%@taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions"%>

<h2><fmt:message key = "clientListForm.title"/></h2>

<div class = "messages"><jsp:include page = "/messages.jsp"/></div>

<p>
   <a href = "${sessionScope.alias}?_action=clientForm">Добавить</a>
</p>

<p>
  <jsp:include page = "/pageNavigation.jsp"/>
</p>

<table width="100%" cellpadding="10" cellspacing="10">
  <thead>
  <tr style="border-bottom: 1px #f1f1f1 solid;">
    <th><a class="head" href="${sessionScope.alias}?_action=listClients&orderBy=name&order=${order}&page=${currentPage}"><fmt:message key = "client.lastName"/></a></th>                        
    <th><a class="head" href="${sessionScope.alias}?_action=listClients&orderBy=tel&order=${order}&page=${currentPage}"><fmt:message key = "client.tel1"/></a></th>
    <th><a class="head" href="${sessionScope.alias}?_action=listClients&orderBy=email&order=${order}&page=${currentPage}"><fmt:message key = "client.email1"/></a></th>
    <th>&nbsp;</th>
   </tr>
   </thead>
   
   <tbody>
     <c:forEach var = "client" items = "${clientsList}">
       <tr style="border-bottom: 1px #f1f1f1 solid;">               
         <td><c:out value = "${client.formName}"/></td>               
         <!--<td><c:out value = "${client.clientType}"/></td>-->
         <td><c:out value = "${client.tel1}"/></td>
         <td>
           <a href="mailto:${client.email1}">${client.email1}</a>
         </td>
         <!--<td><c:out value = "${client.www}"/></td>-->
         <td>
           <a href = "${sessionScope.alias}?_action=deleteClient&client_id=${client.id}" onclick="return confirm('Вы действительно хотите удалить клиента?')">
             <fmt:message key = "client.operations.remove"/>
           </a>
           
           <a href = "${sessionScope.alias}?_action=clientForm&client_id=${client.id}">
             <fmt:message key = "client.operations.edit"/>
           </a>
                      
         </td>
       </tr>
     </c:forEach>          

     <c:if test="${fn:length(clientsList) == 0}">
       <tr>
         <td colspan="4" align="center">Список пуст</td>
       </tr>
   </c:if>

   </tbody>
 </table>

<p><jsp:include page = "/pageNavigation.jsp"/></p>

<p>
   <a href = "${sessionScope.alias}?_action=clientForm">Добавить</a>
</p>